// index.js
const app = getApp();
Page({
  onLoad(options) {
    let token= wx.getStorageSync('token')
    let type=wx.getStorageSync('type')
    if (token) {
    wx.setStorageSync('barIndex', 0)
      if (type==1) {
        wx.switchTab({
          url: '/pages/homePage/homePage'
        })
      } else if(type==2){
        wx.switchTab({
          url: '/pages/materialFlow/materialFlow'
        })
      }
    } else{
      wx.clearStorageSync();
      wx.redirectTo({
        url: '/pages/login/login'
      })
    }
  },
})